var Contest=Contest||{};
fastCSharp.Copy(Contest,{
Load:function()
	{
	var SkinValue=fastCSharp.PageView.SkinValue.SkinValue;
	if(SkinValue.currentUser&&SkinValue.judgeTicks.toString()!='0')
		{
		fastCSharp.Poll.Query.ContestId=SkinValue.contest.Id;
		fastCSharp.Poll.Query.ContestTime=SkinValue.judgeTicks;
		if(!this.IsPoll)
			{
			fastCSharp.Poll.OnMessage.Add(fastCSharp.ThisFunction(this,this.OnPoll));
			this.IsPoll=1;
			}
		}
	else	{
		delete fastCSharp.Poll.Query.ContestId;
		delete fastCSharp.Poll.Query.ContestTime;
		}
	},
OnPoll:function(Value)
	{
	if(Value=Value.ContestJudges)
		{
		if(Value.length)
			{
			fastCSharp.Poll.Query.ContestTime=Value[0].Judge.FinishedTicks;
			var SkinValue=fastCSharp.PageView.SkinValue,MaxSize=SkinValue.SkinValue.pageInfo.Size*2;
			for(var Ids={},Index=Value.length;Index;Ids[Value[--Index].Judge.Id]=1);
			for(var Judges=(SkinValue=SkinValue.judges).SkinValue,Index=0;Index-Judges.length;++Index)
				{
				if(!Ids[Judges[Index].Judge.Id])
					{
					Value.push(Judges[Index]);
					if(Value.length>=MaxSize)	break;
					}
				}
			SkinValue.Set(Value);
			}
		else	{
			delete fastCSharp.Poll.Query.ContestId;
			delete fastCSharp.Poll.Query.ContestTime;
			}
		}
	}
		});
fastCSharp.OnLoad(Contest.Load,Contest);